#include <pcap.h>

#include "socket_task.h"
#include "log.h"
#include "msg.h"
#include "pcap_process.h"
#include "packet_recv.h"

#include "sql.h"

//extern unsigned long raw_packet_count = 0;
//extern unsigned long ipv4_packet_count = 0;

int socket_ops(struct msg *msg)
{
	log_info("begin socket_ops.");

	return 0;
}

void *socket_main(void *data)
{
	log_info("begin socket_loop.");

	sql_init();

	int res;
	res = sql_query("create table pcapTableInfo(id int, tableName char(128))");
	if (res) {
		log_print("sql_query error: %d, %s\n", sql_errorno(), sql_error());
	}
	
	packet_recv_loop(core_conf.s,*(core_conf.addr),&pcap_task_packet_process);
	/* NOT REACHED HERE */

	return NULL;
}
